import os
from openpyxl import load_workbook

file_path = os.path.join('file','服务器.xlsx')

work_book_object = load_workbook(file_path)

# 获取表中所有sheet名字
data_list = work_book_object.sheetnames
#print(data_list)
# 获取表中sheet及数据
v2 = work_book_object.worksheets
#print(v2)

sheet_object1 = v2[0]
sheet_object2 = work_book_object["云账号"]

print(sheet_object1)
print(sheet_object2)

# 读取sheet的坐标
cell_object = sheet_object1.cell(1,1)

# 读取sheet坐标中的内容
print(cell_object.value)


cell_object02= sheet_object2["C3"]
print(cell_object02.value)


# 读取一行
sheet_object3 = v2[1]
row_list = sheet_object3[1]
print(row_list)

for haha in row_list:
    print(haha.value)

for row in sheet_object3.rows:
    #print(row)
    row_text_list = []
    for cell in row:
        row_text_list.append(cell.value)
    print(row_text_list)

